﻿@model KhuyenMaiVang.Models.PagingModel

<div class="th-padding-container">
    <p class="th-padding-info-data-display">
        Hiển thị từ @Model.DataStart đến @Model.DataEnd của @Model.TotalData</p>
    <ul >
        @{
            if(Model.PageMin > 1){
                var routes = new RouteValueDictionary(Model.OtherRoutes);
                routes.Add("page", 1);
                <li class="th-padding-backnext">
                    <a href="@Url.Action(Model.Action, Model.Controller, routes)">
                        <span class="padding-nextback">&lt;&lt;</span>
                    </a>                
                </li>
            }
            
            for (int i = Model.PageMin; i <= Model.PageMax; i++)
            {
                var routes = new RouteValueDictionary(Model.OtherRoutes);
                routes.Add("page", i);
                if (i != Model.CurrentPage)
                {
            <li class="th-padding-item"><a href="@Url.Action(Model.Action, Model.Controller, routes)">
                <span>@i</span></a></li>
                }
                else
                {
            <li class="th-padding-item th-padding-current"><a href="@Url.Action(Model.Action, Model.Controller, routes)">
                <span>@i</span></a></li>
                }
            }
            
             if(Model.PageMax < Model.TotalPage)
             {
                var routes = new RouteValueDictionary(Model.OtherRoutes);
                routes.Add("page", Model.TotalPage);
                <li class="th-padding-backnext">
                    <a href="@Url.Action(Model.Action, Model.Controller, routes)">
                        <span class="padding-nextback">&gt;&gt;</span> 
                    </a>
                </li>
            }
        }
    </ul>
    <div style="clear: both" ></div>
</div>
